//
//  MPTPasterObject.h
//  MPTCapture
//
//  Created by Jeakin on 7/29/15.
//  Copyright © 2015 Jeakin. All rights reserved.
//

#import <AVFoundation/AVFoundation.h>

struct YXPasterTime {
    CGFloat time;
    BOOL mute;
    BOOL canPlay;
};
typedef struct YXPasterTime YXPasterTime;

struct YXPasterRange {
    CGFloat start;
    CGFloat lenght;
};
typedef struct YXPasterRange YXPasterRange;

static inline YXPasterTime YXPasterTimeMake(CGFloat time, BOOL mute,BOOL canPlay) {
    YXPasterTime result;
    result.time = time;
    result.mute = mute;
    result.canPlay = canPlay;
    return result;
}

static inline YXPasterRange YXPasterRangeMake(CGFloat start, CGFloat lenght) {
    YXPasterRange range;
    range.start = start;
    range.lenght = lenght;
    return range;
}

@interface YXVideoPasterObject : NSObject
//贴纸ID
@property (nonatomic,strong) NSString               *sthid;
//贴纸名称
@property (nonatomic,strong) NSString               *name;
//层级
@property (nonatomic,assign) NSInteger              zIndex;
//动画持续时间
@property (nonatomic,assign) CGFloat                duartion;
//贴纸开始时间
@property (nonatomic,assign) CGFloat                startTime;
//总帧数
@property (nonatomic,assign) NSInteger              frameCount;
//分类
@property (nonatomic,strong) NSString               *category;
//每帧持续时间
@property (nonatomic,assign) CGFloat                frameDuartion;
//贴纸原始尺寸
@property (nonatomic,assign) CGSize                 pasterSize;
//视频时长
@property (nonatomic,assign) CGFloat                maxDuartion;
//转置矩阵
@property (nonatomic,assign) CGAffineTransform      transform;
//贴纸路径
@property (nonatomic,strong) NSString               *pasterFilePath;
//贴纸帧数据
@property (nonatomic,strong) NSArray                *frames;
//贴纸帧时间
@property (nonatomic,strong) NSArray                *times;
//贴纸当前时间
@property (nonatomic,assign) YXPasterTime          time;
//是否静音
@property (nonatomic,assign) BOOL                   isMute;
//音效文件路径
@property (nonatomic,readonly) NSString              *soundEffectPath;
//贴纸最后一次编辑的数据
@property (nonatomic,assign) YXPasterRange         lastRange;

//显示帧
@property (nonatomic, readonly) NSInteger            showFrame;

- (instancetype)initWithJSONFilePath:(NSString *)filePath;


- (void)playSound;
- (void)pauseSound;
- (void)reloadSound;
- (void)seekToAbsoluteTime:(CGFloat)time;

@end
